package com.ruge.common.util;

import com.ruge.system.pojo.entity.SysUser;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Caching;

/**
 * 创建人 ：爱丽丝、如歌
 * 创建时间 ：2020-03-05  8:43
 * 描述 ：缓存工具类
 */
public class CacheUtils {
    /**
     * 清除当前用户redis缓存
     */
    @Caching(evict = {
            @CacheEvict(value = "user", key = "'user_id_'+T(String).valueOf(#result.id)", condition = "#result.id != null and #result.id != 0"),
            @CacheEvict(value = "user", key = "'user_name_'+#result.loginName", condition = "#result.loginName !=null and #result.loginName != ''"),
            @CacheEvict(value = "user", key = "'user_email_'+#result.email", condition = "#result.email != null and #result.email != ''"),
            @CacheEvict(value = "user", key = "'user_tel_'+#result.tel", condition = "#result.tel != null and #result.tel != ''"),
    })
    public SysUser clearUserCache() {
     /*   User user = new User();
        user.setId(MySysUser.id());
        return user.selectById();*/
        return null;
    }
}
